﻿//
// Copyright (c) 2024 BPer
//
#include <bperutil/sys/BPerFile.h>

#ifdef _MSC_VER
#include <direct.h>
#endif

int32_t bPer_getCurpath(char* path){
#ifdef _MSC_VER
    if(_getcwd(path, 255)) return BPer_Ok;
#else
    if(getcwd(path, 255)) return BPer_Ok;
#endif
	return 1;
}
int32_t bPer_getLibpath(char* path){

char tmp[255];
bPer_memset(tmp,0,sizeof(tmp));
#ifdef _MSC_VER
    if(_getcwd(tmp, 255)) {

#else
    if(getcwd(tmp, 255)) {
#endif
    	bPer_sprintf(path,sizeof(path),"%s/lib",tmp);
    	return BPer_Ok;
    }
	return 1;
}

int32_t bPer_getCaFile(char* pem,char* key){
    	char tmp[200];
    	bPer_memset(tmp,0,sizeof(tmp));
#ifdef _MSC_VER
    if(_getcwd(tmp, 200)) {

#else
    if(getcwd(tmp, 200)) {
#endif
    	bPer_sprintf(pem,sizeof(pem),"%s/lib/client.pem",tmp);
    	bPer_sprintf(key,sizeof(key),"%s/lib/client.key",tmp);
    	return BPer_Ok;
    }
    return 1;
    }



